<UserControl xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  x:Class="Rawr.UI.BatchTools"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
	xmlns:local="clr-namespace:Rawr.UI"
	xmlns:Rawr="clr-namespace:Rawr;assembly=Rawr.Base"
	xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
	xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
	xmlns:menu="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
	xmlns:splitButton="clr-namespace:Delay;assembly=SplitButton"
	VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
	<UserControl.Resources>
		<local:NullToVisibilityConverter x:Key="nullToVisibilityConverter"/>
		<DataTemplate x:Key="DataTemplateOpenButton">
			<Button Click="OpenButton_Click" Content="..."/>
		</DataTemplate>
		<DataTemplate x:Key="DataTemplateShowButton">
			<Button Click="ShowButton_Click" Visibility="{Binding Character, Converter={StaticResource nullToVisibilityConverter}, FallbackValue=Hidden}" Content="Show"/>
		</DataTemplate>
		<DataTemplate x:Key="DataTemplateDiffButton">
			<Button Click="DiffButton_Click" Visibility="{Binding Character, Converter={StaticResource nullToVisibilityConverter}, FallbackValue=Hidden}" Content="Diff"/>
		</DataTemplate>
	</UserControl.Resources>
	<UserControl.DataContext>
		<Rawr:BatchTools/>
	</UserControl.DataContext>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="30"/>
			<RowDefinition Height="*"/>
			<RowDefinition Height="22"/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*"/>
			<ColumnDefinition Width="200"/>
		</Grid.ColumnDefinitions>
		<!--IFSL-->
		<Rectangle VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Margin="-1,-1,-1,0">
			<Rectangle.Stroke>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FFA3AEB9"/>
					<GradientStop Color="#FF8399A9" Offset="0.375"/>
					<GradientStop Color="#FF718597" Offset="0.375"/>
					<GradientStop Color="#FF617584" Offset="1"/>
				</LinearGradientBrush>
			</Rectangle.Stroke>
			<Rectangle.Fill>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FFDEDEDE" Offset="1"/>
					<GradientStop Color="#FFFFFFFF" Offset="0"/>
				</LinearGradientBrush>
			</Rectangle.Fill>
		</Rectangle>
		<StackPanel Margin="0,4,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
			<splitButton:MenuButton Content="File" x:Name="FileMenu" HorizontalAlignment="Left" Margin="2,0,2,0" Padding="6,3,6,3">
				<splitButton:MenuButton.ButtonMenuItemsSource>
                    <menu:MenuItem Header="New" Click="New"/>
                    <menu:MenuItem Header="Import" Click="Import"/>
                    <menu:MenuItem Header="Open" Click="Open" IsEnabled="False"/>
                    <menu:MenuItem Header="Save" Click="Save" IsEnabled="False"/>
                    <menu:MenuItem Header="Save As..." Click="SaveAs" IsEnabled="False"/>
                    <menu:Separator/>
                    <menu:MenuItem Header="Exit" Click="Close"/>
				</splitButton:MenuButton.ButtonMenuItemsSource>
			</splitButton:MenuButton>
			<splitButton:MenuButton Content="Tools" x:Name="ToolsMenu" HorizontalAlignment="Left" Margin="2,0,2,0" Padding="6,3,6,3">
				<splitButton:MenuButton.ButtonMenuItemsSource>
                    <menu:MenuItem Header="Set Available Items" Click="SetAvailableItems"/>
                    <menu:MenuItem Header="Replace Unavailable" Click="ReplaceUnavailable"/>
                    <menu:MenuItem Header="Optimize" Click="Optimize"/>
                    <menu:MenuItem Header="Build Upgrade List" Click="BuildUpgradeList"/>
                    <menu:MenuItem Header="Batch Optimize" Click="BatchOptimize"/>
                    <menu:MenuItem Header="Build Batch Upgrade List" Click="BuildBatchUpgradeList"/>
                    <menu:MenuItem Header="Progressive Optimize" Click="ProgressiveOptimize"/>
                    <menu:MenuItem Header="Build Progressive Upgrade List" Click="BuildProgressiveUpgradeList"/>
                    <menu:Separator/>
                    <menu:MenuItem Header="Save Characters" Click="SaveCharacters"/>
                    <menu:MenuItem Header="Save Characters As Copy" Click="SaveCharactersAs"/>
				</splitButton:MenuButton.ButtonMenuItemsSource>
			</splitButton:MenuButton>
		</StackPanel>
		<!--ENDIFSL-->
		<!--IFWPF
		<Menu VerticalAlignment="Top" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="0">
			<MenuItem Header="File" Margin="4,0,4,0">
				<MenuItem Header="New" Click="New"/>
				<MenuItem Header="Import" Click="Import"/>
				<MenuItem Header="Open" Click="Open"/>
				<MenuItem Header="Save" Click="Save"/>
				<MenuItem Header="Save As..." Click="SaveAs"/>
				<Separator/>
				<MenuItem Header="Exit" Click="Close"/>
			</MenuItem>
			<MenuItem Header="Tools" Margin="4,0,4,0">
				<MenuItem Header="Set Available Items" Click="SetAvailableItems"/>
				<MenuItem Header="Replace Unavailable" Click="ReplaceUnavailable"/>
				<MenuItem Header="Optimize" Click="Optimize"/>
				<MenuItem Header="Build Upgrade List" Click="BuildUpgradeList"/>
				<MenuItem Header="Batch Optimize" Click="BatchOptimize"/>
				<MenuItem Header="Build Batch Upgrade List" Click="BuildBatchUpgradeList"/>
				<MenuItem Header="Progressive Optimize" Click="ProgressiveOptimize"/>
				<MenuItem Header="Build Progressive Upgrade List" Click="BuildProgressiveUpgradeList"/>
				<Separator/>
				<MenuItem Header="Save Characters" Click="SaveCharacters"/>
				<MenuItem Header="Save Characters As Copy" Click="SaveCharactersAs"/>
			</MenuItem>
		</Menu>
		ENDIFWPF-->
		<Grid Grid.Column="1" Grid.Row="1">
			<StackPanel Orientation="Vertical">
				<dataInput:Label Margin="4,4,4,4" Content="Thoroughness"/>
                <!--IFSL-->
                <Slider Margin="4,4,4,4" Minimum="1" Maximum="400" Value="{Binding Thoroughness}" />
		        <!--ENDIFSL-->
                <!--IFWPF
                <Slider Margin="4,4,4,4" Minimum="1" Maximum="400" TickFrequency="10" TickPlacement="BottomRight" Value="{Binding Thoroughness}" />
                ENDIFWPF-->
				<CheckBox Margin="4,4,4,4" IsChecked="{Binding OverrideRegem}" Content="Override Regem"/>
				<CheckBox Margin="4,4,4,4" IsChecked="{Binding OverrideReenchant}" Content="Override Reenchant"/>
                <CheckBox Margin="4,4,4,4" IsChecked="{Binding OverrideReforge}" Content="Override Reforge"/>
                <Grid Margin="4,4,4,4">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
					<dataInput:Label Grid.Column="0" Content="Max Rounds:"/>
                    <!--IFSL-->
                    <Slider Grid.Column="1" Minimum="1" Maximum="5" Value="{Binding MaxRounds}"/>
		            <!--ENDIFSL-->
                    <!--IFWPF
                    <Slider Grid.Column="1" Minimum="1" Maximum="5" TickPlacement="BottomRight" Value="{Binding MaxRounds}"/>
                    ENDIFWPF-->
				</Grid>
				<dataInput:Label Margin="4,4,4,0" Content="Single Item Upgrades"/>
				<TextBox Margin="4,0,4,0" x:Name="SingleItemUpgrade"/>
			</StackPanel>
		</Grid>
		<data:DataGrid x:Name="DataGrid" Grid.Column="0" Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding BatchCharacterList}" SelectionChanged="DataGrid_SelectionChanged">
			<data:DataGrid.Columns>
				<!--IFWPF
				<data:DataGridTextColumn Width="*" CanUserSort="False" IsReadOnly="True" Binding="{Binding Name}" Header="Character"/>
				ENDIFWPF-->
				<!--IFSL-->
				<data:DataGridTextColumn CanUserSort="False" IsReadOnly="True" Binding="{Binding Name}" Header="Character"/>
				<!--ENDIFSL-->
				<data:DataGridCheckBoxColumn Width="SizeToHeader" CanUserSort="False" Binding="{Binding Locked}" Header="Locked"/>
				<data:DataGridTextColumn CanUserSort="False" Binding="{Binding Weight}" Header="Weight"/>
				<data:DataGridTextColumn CanUserSort="False" IsReadOnly="True" Binding="{Binding Score}" Header="Score"/>
				<data:DataGridTextColumn CanUserSort="False" IsReadOnly="True" Binding="{Binding NewScore}" Header="New Score"/>
				<data:DataGridTemplateColumn Width="20" CellTemplate="{StaticResource DataTemplateOpenButton}" />
				<data:DataGridTemplateColumn Width="50" CellTemplate="{StaticResource DataTemplateShowButton}" />
				<data:DataGridTemplateColumn Width="50" CellTemplate="{StaticResource DataTemplateDiffButton}" />
			</data:DataGrid.Columns>
		</data:DataGrid>
		<Button x:Name="ButtonUp" Grid.Column="1" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" IsEnabled="False" Margin="3,3,3,3" Width="23" Height="23" Click="ButtonUp_Click" Content="↑"/>
		<Button x:Name="ButtonDown" Grid.Column="1" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" IsEnabled="False" Margin="29,3,3,3" Width="23" Height="23" Click="ButtonDown_Click" Content="↓"/>
		<Button x:Name="ButtonCancel" Grid.Column="1" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" IsEnabled="False" Margin="3,3,3,3" Width="Auto" Height="23" Click="ButtonCancel_Click" Content="Cancel"/>
		<Grid Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2">
			<Grid.RowDefinitions>
				<RowDefinition Height="30"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="250"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>
			<dataInput:Label Grid.Column="0" x:Name="StatusLabel"/>
			<ProgressBar Grid.Column="1" x:Name="StatusProgress"/>
		</Grid>
	</Grid>
</UserControl>
